<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
	<title>南水北调综合查询系统</title>
	<link href="<%=basePath%>jclient/css/login.css" rel="stylesheet" type="text/css" />
 	<meta http-equiv="X-UA-Compatible" content="IE=8"/>
    <%@include file="common/util.jsp" %>
    <script type="text/javascript">
    //cookie 保存设置   
     $(function ($) {  
          var userName = COOKIE_UTIL.getCookie("loginName");  
          var userPswd;  
          //页面初始化判断是否有cookie记录   
          if (userName != null) {
              userPswd = COOKIE_UTIL.getCookie("loginPwd");  
              $("#loginName").val(userName);  
              $("#loginPwd").val(userPswd);  
              $("#isSavaCookie").attr("checked", "checked");  
            }  
           //注册登录按钮事件   
            $("#login").click(function () {  
              userName = $("#loginName").val();  
              userPswd = $("#loginPwd").val();  
              var isSavaCookie = $("#isSavaCookie").attr("checked"); 
               //如果勾选保存密码则保存cookie，否则删除   
              if (isSavaCookie == undefined) {  
                   COOKIE_UTIL.delCookie("loginName");  
                   COOKIE_UTIL.delCookie("loginPwd");  
              } else {  
                   COOKIE_UTIL.savaCookie("loginName", userName, {expires: 7});  
                   COOKIE_UTIL.savaCookie("loginPwd", userPswd, {expires: 7});  
               }  
              login();  
            });  
       });  
      //对cookie 进行保存-获取-删除   
       var COOKIE_UTIL = new function () {  
          this.savaCookie = function (the_cookie, the_value, option) {  
              $.cookie(the_cookie, the_value, option);  
          };  
          this.getCookie = function (the_cookie) {  
              return $.cookie(the_cookie);  
          } ; 
          this.delCookie = function (the_cookie) {  
               $.cookie(the_cookie, null);  
          } ; 
       };  
    </script>
  <script type="text/javascript">
 	 function login(){
 		 var name=$("#loginName").val();
 		 var pass=$("#loginPwd").val();
 		 if(name==""){
 			$("#msg1").html("用户名不能为空!");
 			return;
 		 }else if(pass==""){
 			$("#msg1").html("密码不能为空!"); 
 			return;
 		 }else{
 			//$.post(systemConstants.CONTEXT_PATH + "/loginController/validUserLogin.jsp", {
 				//loginName :name,
 				//loginPwd : pass
 			//}, function(data) {
 				//if (data.msg == "ok") {
 					//gotoUrl = systemConstants.CONTEXT_PATH + "/main.htm?param=main";
 					gotoUrl = systemConstants.CONTEXT_PATH +"/jclient/pages/main/main.jsp";//
 					window.location.href = gotoUrl;
 				//} else {
 					$("#msg1").html(data.msg);
 				//}
 			//},'json');
 		 }
 	 }
 //用于键盘enter键进入
 	document.onkeydown = function(e) {
 		if (!e)
 			e = window.event;//火狐中是 window.event
 		if ((e.keyCode || e.which) == 13) {
 			login();
 		}
 	};
 	</script>
  </head>
  <body>
   <div class="login" align="center">
   	  <div class="userlogin">
          <span class="logo"></span>
            <div class="loginbar">
            <ul>
            <li id="choose"><label>&nbsp;</label>
            </li>
            <li> </li>
            <li>
              <label>用&nbsp;户：</label>
              <span class="user"><input name="loginName" type="text" class="logininput" id="loginName" /></span></li>
            <li>
              <label>密&nbsp;码：</label>
              <span class="password">
              <input name="input" type="password" class="logininput" id="loginPwd" name="loginPwd"/>
            </span></li>
            <li style="margin-left: -80px;"><label>&nbsp;</label>
              <input type="checkbox" id="isSavaCookie"/>记住密码
              <input name="loginPwd" type="button" value="登录"  class="loginbtn" id="login" onclick="login();"/>
            </li>
            <li>
            <span id="msg1" style="color: red"></span>
            </li>
            </ul>
          </div>
            <div class="logindown"></div>
            <div class="systeminfo">
            	<span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;北京圣世信通科技发展有限公司 &nbsp;</span>            </div>
      </div>
    </div>
  </body>
</html>
